From c70257142ff1e8e4cef14bc7784f655b7ae442c2 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 22 Nov 2002 16:32:27 +0000 Subject: [PATCH] Better determination of garmin waypoint shortname length. From Alan acurry. --- garmin.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/garmin.c b/garmin.c index 26c187dee..ce3049e23 100644 --- a/garmin.c +++ b/garmin.c @@ -154,23 +154,49 @@ data_write(void) i = 0; /* - * FIXME: Someone that knows the Garmin protocol could - * do something clever here and switch on gps_save_id to - * setshort_length to - * 15 for the V, + * Grope the unit we're talking to to set setshort_length to + * 20 for the V, * 10 for Street Pilot, Rhino, 76 * 6 for the III, 12, emap, and etrex * Fortunately, getting this "wrong" only results in ugly names * when we're using the synthesize_shortname path. */ short_length = 10; - switch (gps_save_id) { - case 155: - short_length = 20; + + switch ( gps_waypt_type ) /* waypoint type as defined by jeeps */ + { + case 100: /* The GARMIN GPS Interface Specification, */ + case 101: /* says these waypoint types use an ident */ + case 102: /* length of 6. Waypoint types 106, 108 */ + case 103: /* and 109 are all variable length */ + case 104: + case 105: + case 107: + case 150: + case 151: + case 152: + case 154: + case 155: + short_length = 6; + break; + case 106: /* Waypoint types with variable ident length */ + case 108: /* Need GPSr id to know the actual length */ + case 109: + switch ( gps_save_id ) + { + case 130: /* Garmin Etrex (yellow) */ + short_length = 6; + break; + case 155: /* Garmin V */ + short_length = 20; + break; + default: + break; + } break; - default: - short_length = 10; + default: break; + } setshort_length(short_length); setshort_mustupper(1); -- 2.30.2